//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================

#ifdef _MSC_VER

#pragma warning(disable:4305)
#pragma warning(disable:4244)
#pragma warning(disable:4101)
#pragma warning(disable:4761)
#endif

#define VGABASE 0xF0000000

//////
/* Clock related */
typedef struct {
    unsigned char msr;
    unsigned char xr2A;
    unsigned char xr2B;
    unsigned char xr2C;
    unsigned char xr2D;
    unsigned char xr13;            /* extended clock gen for 5597 */
    int Clock;
} sisClockReg, *sisClockPtr;

typedef struct {
    vgaHWRec std;                  /* std IBM VGA register     */

    /* 0x37 top for 20x, 0x3D for 5597, 0x3F for 530*/
    unsigned char Port_3C4[0x40];
    unsigned char Port_3D4[0x1B];    /* Only CR19 and CR1A used by 630 */
    unsigned char ClockReg2;
    sisClockReg   sisClock;
} vgaSISRec, *vgaSISPtr;

typedef struct {
    Boolean (* ChipProbe)();
    char * (* ChipIdent)(int);
    void (* ChipEnterLeave)(Boolean);
    Boolean (* ChipInit)(DisplayModePtr);
    int (* ChipValidMode)(DisplayModePtr mode, Boolean verbose, int flag);
    void * (* ChipSave)(void *);
    void (* ChipRestore)(void *);
//    void (* ChipRestore)(vgaSISPtr);
    void (* ChipAdjust)(int, int);
    void (* ChipSaveScreen)(long int);
    void (* ChipGetMode)( );
    void (* ChipFbInit)( );
    void (* ChipSetRead)(  );
    void (* ChipSetWrite)(  );
    void (* ChipSetReadWrite)( );
    int ChipMapSize;
    int ChipSegmentSize;
    int ChipSegmentShift;
    int ChipSegmentMask;
    int ChipReadBottom;
    int ChipReadTop;
    int ChipWriteBottom;
    int ChipWriteTop;
    Boolean ChipUse2Banks;               /* TRUE if the chip uses separate read
    and write banks */
    int ChipInterlaceType;            /* divide vertical timing values for
    interlaced modes */
    OFlagSet ChipOptionFlags;         /* option flags support by this driver */
    int ChipRounding;                 /* the horizontal resolution rounding */
    Boolean ChipUseLinearAddressing;        /* TRUE if driver has requested linearaddressing */
    int ChipLinearBase;            /* Physical base address of the linearframebuffer */
    int ChipLinearSize;            /* Size of the linear framebuffer */
    Boolean ChipHas16bpp;            /* Driver supports 16bpp */
    Boolean ChipHas24bpp;            /* Driver supports 24bpp */
    Boolean ChipHas32bpp;            /* Driver supports 32bpp */
    DisplayModePtr ChipBuiltinModes;  /* Pointer to builtin mode list */
    int ChipClockMulFactor;        /* Factor to multiply pixel clock by, to getRAMDAC clock */
    int ChipClockDivFactor;        /* Factor to divide pixel clock by, to getRAMDAC clock */
} vgaVideoChipRec, *vgaVideoChipPtr;

//extern vgaVideoChipRec;
extern vgaVideoChipPtr Drivers[];
extern pciConfigPtr  *vgaPCIInfo;
